package com.xpf.controller;

import com.xpf.entity.CustomerStatusChangeBatchAuditReq;
import com.xpf.service.process.LanDrayProcessServiceImpl;
import com.xpf.service.process.enums.LanDrayProcessEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/customerController")
public class CustomerController {

    @Autowired
    private LanDrayProcessServiceImpl lanDrayProcessService;

    @PostMapping("/startProcess")
    public String startProcess(@Validated @RequestBody CustomerStatusChangeBatchAuditReq process){

        process.setProcessKey(LanDrayProcessEnum.CUSTOMER_STATUS_CHANGE.getProcessKey());
        return lanDrayProcessService.createProcess(null,process,process.getProcessKey());
    }


    @PostMapping("/first")
    public String firstProcess(@Validated @RequestBody CustomerStatusChangeBatchAuditReq process){

        process.setProcessKey(LanDrayProcessEnum.FIRST_TEST.getProcessKey());
        return lanDrayProcessService.createProcess(null,process,process.getProcessKey());
    }

}
